<template>
    <div id="app">
    <HeaderPage  :avatar="avatar" :nick_name="nick_name" :is_admin="isAdmin"></HeaderPage>
    <h5 class="page_title"><el-button link @click="goto_user_center"> &lt;返回</el-button> &nbsp;我贡献的内容</h5>  
 
       <router-view></router-view>

    <FooterPage></FooterPage>
    </div>
</template>

<script>
import HeaderPage from '@/components/HeaderPage.vue'
import FooterPage from '@/components/FooterPage.vue'
import axios from 'axios'
import config from '../../spoken.config.json';
import { ElNotification } from 'element-plus';

export default{
    name:'MyContribution',
    components:{
        HeaderPage,
        FooterPage,
    },
    data(){
        return{
            nick_name:null,
            avatar:null,
            user_id:null,
            isAdmin:false,
        }
    },
    created(){
        this.user_profiles();
        this.loadWordsBank();
    },
    mounted(){
        },
    methods:{
      
        //获取用户信息
        async user_profiles(){
            const login_token= await this.$commonFunctions.get_cookies('login_token')
            console.log("我贡献的词条页面login_token："+login_token);
            
            const user_profiles= await this.$commonFunctions.get_user_profiles(login_token);
            console.log("我贡献的词条页面，初始化数据："+JSON.stringify(user_profiles))

            this.nick_name=user_profiles.name;
            this.avatar=user_profiles.avatar;
            this.user_id=user_profiles.user_id;
            this.isAdmin=user_profiles.is_superuser;
        },

        loadWordsBank(){
            this.$router.push({name:'WordsBank',params:{param1:encodeURIComponent('#contribute')}});
        },
        goto_user_center(){
            this.$router.push({ path: '/user_center/' });
        },
    },
}
</script>

<style scoped>    
.page_title{
    display: flex;
    justify-content: start;
}
</style>